package com.gimi.cloud.bbp.dto.page;

import com.gimi.cloud.bbp.dto.base.BaseDTO;
import com.github.pagehelper.Page;

import java.util.Arrays;
import java.util.Date;
import java.util.List;

public class PageConfigDTO extends BaseDTO{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * 主键
	 */
	private Integer id;
	
	/**
	 * 页面名称
	 */
	private String pageName;
	
	/**
	 * 开始时间
	 */
	private Date startTime;
	
	/**
	 * 到期时间
	 */
	private Date endTime;
	
	/**
	 * 结束后无活动是否显示默认
	 */
	private Integer pageDefault;
	
	/**
	 * 类型:首页1 专场2
	 */
	private Integer type;
	
	/**
	 * 描述
	 */
	private String describes;
	
	/**
	 * 状态1未审核2审核不通过3定时发布4已发布5下架
	 */
	private Integer status;
	
	private List<PageColumnDTO> pageColumns;
	
	private Integer page = 0;
	
	private Integer column = 3;
	
	private Long count;
	
	private Integer[] ids;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getPageName() {
		return pageName;
	}

	public void setPageName(String pageName) {
		this.pageName = pageName;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public Integer getPageDefault() {
		return pageDefault;
	}

	public void setPageDefault(Integer pageDefault) {
		this.pageDefault = pageDefault;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public String getDescribes() {
		return describes;
	}

	public void setDescribes(String describes) {
		this.describes = describes;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public List<PageColumnDTO> getPageColumns() {
		return pageColumns;
	}

	public void setPageColumns(List<PageColumnDTO> pageColumns) {
		this.pageColumns = pageColumns;
		if (pageColumns instanceof Page) {
            Page page = (Page) pageColumns;
            this.page = page.getPageNum();
            this.column = page.getPageSize();
            this.count = page.getTotal();
		}
	}

	public Integer getPage() {
		return page;
	}

	public void setPage(Integer page) {
		this.page = page;
	}

	public Integer getColumn() {
		return column;
	}

	public void setColumn(Integer column) {
		this.column = column;
	}

	public Long getCount() {
		return count;
	}

	public void setCount(Long count) {
		this.count = count;
	}

	public Integer[] getIds() {
		return ids;
	}

	public void setIds(Integer[] ids) {
		this.ids = ids;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((column == null) ? 0 : column.hashCode());
		result = prime * result + ((count == null) ? 0 : count.hashCode());
		result = prime * result + ((describes == null) ? 0 : describes.hashCode());
		result = prime * result + ((endTime == null) ? 0 : endTime.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + Arrays.hashCode(ids);
		result = prime * result + ((page == null) ? 0 : page.hashCode());
		result = prime * result + ((pageColumns == null) ? 0 : pageColumns.hashCode());
		result = prime * result + ((pageDefault == null) ? 0 : pageDefault.hashCode());
		result = prime * result + ((pageName == null) ? 0 : pageName.hashCode());
		result = prime * result + ((startTime == null) ? 0 : startTime.hashCode());
		result = prime * result + ((status == null) ? 0 : status.hashCode());
		result = prime * result + ((type == null) ? 0 : type.hashCode());
		return result;
	}

}
